package com.cloud.test03;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;

/**
 * 重定向
 *      服务端指导的客户端行为，
 *      存在两次请求，地址会改变
 *      两次请求不一样
 *      request对象不共享
 * @author DELL
 */
@WebServlet(value = {"/ReTest04","/retest04"})
public class ResponseTest04 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("Servlet04");
        //接受参数
        String uname = request.getParameter("uname");
        System.out.println("Servlet04 "+uname);

        response.sendRedirect("retest05");
    }
}
